Skip to content

Feat/xrp stellar#94

Merged
anhthii merged 8 commits intomainfrom
feat/xrp-stellar
Apr 1, 2026
Merged

Feat/xrp stellar#94
anhthii merged 8 commits intomainfrom
feat/xrp-stellar

Conversation

@vietddude
Copy link
Copy Markdown
Collaborator

@vietddude vietddude commented Mar 30, 2026

Summary

This PR adds XRP and Stellar indexing support and aligns emitted transfer events with wallet-balance consumers.

For Stellar claimable balances, the event contract is intentionally kept from/to-only for downstream services:

  • create_claimable_balance emits only as a source-side debit when two_way_indexing is enabled
  • claim_claimable_balance emits only as a claimant-side credit
  • clawback_claimable_balance clears local claimable-balance state but does not emit a wallet balance event

Changes

  • add XRP RPC client, types, and indexer coverage
  • add Stellar RPC client, types, and indexer coverage
  • wire XRP and Stellar into network enums, config, and worker factory
  • add transaction parsing and tests for:
    • XRP payment flows
    • Stellar payments and account merges
    • Stellar clawback
    • Stellar claimable balance lifecycle
  • persist Stellar claimable balance state in KV
  • add Horizon effects fallback for claim_claimable_balance when local claimable-balance state is missing
  • keep worker routing based on real from/to addresses only

Stellar Claimable Balance Semantics

This PR treats claimable balance operations based on actual wallet balance impact instead of synthetic object addresses:

  • create_claimable_balance
    • updates source wallet balance only
    • emits from=<source>, to=""
  • claim_claimable_balance
    • updates claimant wallet balance only
    • emits from="", to=<claimant>
  • clawback_claimable_balance
    • does not emit a transfer event for wallet balance consumers
    • still clears any persisted local claimable-balance state

This avoids double-counting claimant deposits and avoids exposing synthetic stellar:claimable_balance:<id> addresses to downstream services.

Testing

  • go test ./internal/indexer -short
  • go test ./internal/worker

- Added Conflux mainnet and testnet configurations to the indexer.
- Updated XRP indexer to handle new transaction types including clawback and claimable balance operations.
- Enhanced Stellar indexer to support claimable balance operations and improved transaction metadata handling.
- Removed outdated test files for Stellar and XRP indexers.
- Introduced a new `DirectionalNormalizer` interface to handle transaction normalization based on direction for both Stellar and XRP indexers.
- Added `normalizeDirectionalMetadata` function to process transaction metadata according to the specified direction.
- Updated `StellarIndexer` and `XRPIndexer` to implement the normalization logic.
- Enhanced tests to validate the correct handling of source-side routing for path payments in both Stellar and XRP transactions.
- Added new test cases to ensure proper functionality of the directional normalization feature.
@vietddude vietddude requested a review from anhthii March 30, 2026 10:06
- Added entries for IDE and cache directories to .gitignore.
- Refactored Stellar and XRP indexers to directly assign memo and destination tag fields instead of using metadata methods.
- Updated related tests to reflect changes in transaction metadata handling.
- Updated tests and implementation to use the new MemoType type for memoType fields in Stellar transactions.
- Replaced string comparisons with MemoType constants to ensure consistency and type safety across the codebase.
- Adjusted related tests to reflect the changes in memoType assertions.
@anhthii anhthii merged commit 9f8cff9 into main Apr 1, 2026
2 checks passed
@anhthii anhthii deleted the feat/xrp-stellar branch April 1, 2026 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants